package net.htjs.mobile.nyoa.updateapk;

import java.io.IOException;
import java.util.concurrent.Callable;

import org.apache.http.client.ClientProtocolException;

import net.htjs.mobile.nyoa.util.L;
import net.htjs.mobile.nyoa.util.Util;

import org.json.JSONException;
import org.json.JSONObject;

public class Myinfodata {

	public String NewVersion=null;
	public String DownUrl=null;
	//public String NewVersion=null;
	
	public Myinfodata getmyinfodata(){
		final Myinfodata mid=new Myinfodata();
		
			Object rtn=null;
			try {
				rtn = new Callable() {

					@Override
					public Object call() throws Exception {
						// TODO Auto-generated method stub
						Thread.sleep(10000l);
						try {
							// TODO Auto-generated method stub
							JSONObject jo=Util.getJOFromString(Util.getJsonFromUrl(L.appUpdateUrl	, ""));
							if(jo!=null){
								mid.DownUrl=jo.getString(L.APP.CDOWNLOADURL);
								mid.NewVersion=jo.getString(L.APP.CVERSION);
								}
							} catch (ClientProtocolException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							} catch (IOException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							} catch (JSONException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							}  
						return mid;
					}
				}.call();
			} catch (Exception e2) {
				// TODO Auto-generated catch block
				e2.printStackTrace();
			}
		return (Myinfodata) rtn;
	}
}
